package com.test.daoImp;

import com.test.dao.IWriteDao;
import com.test.database.DataBase;
import com.test.entity.WriteEntity;

public class WriteDaoImp implements IWriteDao {
//	private static int id = 0;

	public boolean in_tb_article_info(WriteEntity data) {

//		id++;
		boolean flag = false;

		// 提取出 数据实体的数据
		int id = data.getId();
		String text = data.getText();
		String title = data.getTitle();
		String name = data.getName();
		String type = data.getType();
		String expectResults = data.getExpectResults();
		String actualResults = data.getActualResults();
		System.out.println("检查pwd  text 是否传入" +text);

		DataBase db = new DataBase("stest");

//		System.out.println("声明插入   insert into tb_article_info (userName,passWord,sex,email) values(?,?,?,?)");

		String sql = "insert into tb_article_info (id,title,name,type,text1,expectResults,actualResults) values(?,?,?,?,?,?,?)";
		Object[] objs = { id, title, name, type, text, expectResults, actualResults };

		flag = db.myUpdate(sql, objs);
		System.out.println("执行插入数据完毕...");
		return flag;

	}

}
